package com.itheima.tlias.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import com.itheima.tlias.mapper.OperateLogMapper;
import com.itheima.tlias.pojo.OperateLog;
import com.itheima.tlias.service.OperateLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OperateLogServiceImpl implements OperateLogService {
    @Resource
    private OperateLogMapper operateLogMapper;

    /**
     * 查询所有日志
     *
     * @param operateLog 日志
     * @param page       页数
     * @param pageSize   每页条数
     * @return 日志列表
     */
    @Override
    public List<OperateLog> findAllLogs(OperateLog operateLog, Integer page, Integer pageSize) {
        try (Page<?> ignored = PageHelper.startPage(page, pageSize)) {
            return operateLogMapper.findAllLogs(operateLog);
        }
    }
}
